/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #f8bbd9 100%);
    min-height: 100vh;
    padding: 10px;
}

/* Main container - responsive height based on context */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Adjust height for full browser tab */
@media (min-height: 600px) {
    body:not(.iframe) .container {
        height: 90vh;
    }
}

/* Instructions panel */
.instructions {
    text-align: center;
    padding: 8px;
    background: linear-gradient(90deg, #4fc3f7, #29b6f6);
    color: white;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
    cursor: help;
    transition: transform 0.2s ease;
}

.instructions:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 195, 247, 0.3);
}

/* Timeline container */
.timeline-container {
    position: relative;
    height: 120px;
    margin: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
}

/* Timeline line */
.timeline-line {
    position: absolute;
    top: 50%;
    left: 30px;
    right: 30px;
    height: 4px;
    background: linear-gradient(90deg, #ff9800, #f57c00);
    border-radius: 2px;
    z-index: 1;
}

/* Timeline markers */
.timeline-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    position: relative;
}

.marker-circle {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4caf50, #388e3c);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    margin-bottom: 8px;
    transition: transform 0.2s ease;
}

.marker-circle:hover {
    transform: scale(1.1);
}

.marker-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
}

/* Drop zones */
.drop-zone {
    width: 80px;
    height: 60px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.drop-zone.drag-over {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
    transform: scale(1.05);
}

.drop-zone.filled {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.2);
}

.drop-zone.correct {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.3);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.drop-zone.incorrect {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.2);
    animation: shake 0.5s ease-in-out;
}

/* Events container */
.events-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 15px;
    background: rgba(240, 248, 255, 0.5);
    border-radius: 10px;
    margin-bottom: 15px;
    min-height: 100px;
    align-items: flex-start;
    overflow-y: auto;
}

/* Event cards */
.event-card {
    background: white;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: grab;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
    max-width: 220px;
    border: 2px solid transparent;
    user-select: none;
}

.event-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #2196f3;
}

.event-card:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.event-card.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
    z-index: 1000;
}

.event-card.placed {
    opacity: 0.5;
    pointer-events: none;
}

.event-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.event-text {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.3;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: auto;
}

.check-btn {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
    min-height: 48px; /* Touch-friendly height */
}

.check-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
}

.check-btn:active {
    transform: translateY(0);
}

.check-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Feedback */
.feedback {
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    text-align: center;
    min-height: 20px;
    transition: all 0.3s ease;
}

.feedback.success {
    background: rgba(76, 175, 80, 0.2);
    color: #2e7d32;
    border: 2px solid #4caf50;
}

.feedback.error {
    background: rgba(244, 67, 54, 0.2);
    color: #c62828;
    border: 2px solid #f44336;
}

/* Progress indicator */
.progress {
    margin-top: 10px;
    text-align: center;
}

#progress-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.success-animation {
    animation: bounce 0.6s ease-in-out;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .timeline-container {
        padding: 0 15px;
        height: 100px;
    }
    
    .marker-circle {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .drop-zone {
        width: 70px;
        height: 50px;
    }
    
    .event-card {
        min-width: 160px;
        max-width: 200px;
        padding: 10px;
    }
    
    .event-text {
        font-size: 13px;
    }
    
    .event-icon {
        font-size: 20px;
    }
    
    .instructions {
        font-size: 14px;
        padding: 6px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .event-card {
        min-height: 48px; /* Minimum touch target size */
    }
    
    .check-btn {
        min-height: 48px;
        padding: 15px 35px;
    }
    
    .marker-circle {
        min-width: 44px;
        min-height: 44px;
    }
}